<?php
/** @var TaxonomyController $this */
/** @var Taxonomy $model */

$this->pageTitle = '分类';

$this->breadcrumbs = array(
	'分类',
);
?>

	<div class="page-header">
		<h1>分类 <?php echo CHtml::link('创建', array('create'), array('class' => 'btn btn-link')); ?></h1>
	</div>
	<p>分类用于内容的分类。术语由词汇表进行组织。比如，一个叫做 "水果" 的词汇表可能会包含术语 "苹果" 和 "香蕉"。</p>
<?php /** @var TbActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'action' => array('saveWeight'),
));
?>
<?php $this->widget('bootstrap.widgets.TbGridView', array(
	'id' => 'taxonomy-grid',
	'dataProvider' => $model->search(),
	'filter' => null,
	'columns' => array(
		/*
		array(
			'name' => 'id',
			'headerHtmlOptions' => array('class' => 'id-column'),
		),*/
		array(
			'name' => 'name',
			'headerHtmlOptions' => array('class' => 'name-column'),
		),
		array(
			'name' => 'slug',
			'headerHtmlOptions' => array('class' => 'slug-column'),
		),
		array(
			'name' => 'description',
			'headerHtmlOptions' => array('class' => 'description-column'),
		),
		array(
			'class' => 'YInputColumn',
			'name' => 'weight',
			'inputHtmlOptions' => array('name' => 'weight')
		),
		array(
			'class' => 'CLinkColumn',
			'linkHtmlOptions' => array('class' => 'btn btn-link'),
			'label' => '添加术语',
			'urlExpression' => 'Yii::app()->createUrl("term/create", array("taxonomy_id"=>$data->id))',
		),
		array(
			'class' => 'bootstrap.widgets.TbButtonColumn',
			'deleteConfirmation' => '删除这个分类将会导致该分类下的所有术语将被删除！且术语下的内容关系也将被删除，请谨慎操作！',
		),
	),
)); ?>
	<div class="text-right">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType' => 'submit',
			'htmlOptions' => array('name' => 'saveWeight'),
			'type' => 'secondary',
			'label' => '保存权重',
		));
		?>
	</div>
<?php $this->endWidget(); ?>